#ifndef TEXTQUERY_H
#define TEXTQUERY_H

#include <memory>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <fstream>
#include <iostream>
#include <sstream>
#include <cstring>
#include <utility>
#include <cstddef>
#include "QueryResult.h"

class QueryResult;
class TextQuery
{
public:
    typedef std::vector<std::string>::size_type line_no;
    TextQuery(std::ifstream&);
    QueryResult query(const std::string&) const;
    void display_map();
private:
    std::shared_ptr<std::vector<std::string> > file;
    std::map<std::string, std::shared_ptr<std::set<line_no> > > wm;
    static std::string cleanup_str(const std::string&);
};

std::string make_plural(size_t ctr, const std::string &word, const std::string &ending);
#endif